import requests

# 添加员工
url = "http://ihrm-java.itheima.net/api/company/department"
header = {"Content-Type":"application/json","Authorization":"Bearer 4b166d4c-a2f4-47f2-9ff9-ae1941356d15"}
json_data = {
            "name": "地狱l",
            "code": "13453226796"
}
resp = requests.post(url=url,headers=header,json=json_data)
print("添加部门",resp.json())
# 查询员工
url_query = "http://ihrm-java.itheima.net/api/api/company/department/1538819153404710912"
header_query = {"Content-Type": "application/json", "Authorization": "Bearer 4b166d4c-a2f4-47f2-9ff9-ae1941356d15"}
resp_query = requests.get(url=url_query, headers=header_query)
print("查询员工", resp_query.json())
# 修改员工
url_modify = "http://ihrm-java.itheima.net/api/company/department/1538819153404710912"
header_modify = {"Content-Type": "application/json", "Authorization": "Bearer 4b166d4c-a2f4-47f2-9ff9-ae1941356d15"}
modify_data = {"name":"八戒大","code":"13453664795"}
resp_modify = requests.put(url=url_modify, headers=header_modify,json=modify_data)
print("修改员工",resp_modify.json())
# 删除员工
url_del = "http://ihrm-java.itheima.net/api/company/department/1538819153404710912"
header_del = {"Content-Type": "application/json", "Authorization": "Bearer 4b166d4c-a2f4-47f2-9ff9-ae1941356d15"}
resp_del = requests.delete(url=url_del, headers=header_del)
print("删除员工", resp_del.json())